package core.report.yearReport.bean;

import org.springframework.jdbc.support.rowset.SqlRowSet;

public class CustomSalesReportDataBean extends SalesReportDataBean{
	
	private double piecesPrice;
	private double pieces_per_price;

	@Override
	public void setProperties(SqlRowSet rs) {
		this.shopId = rs.getInt("shopId");
		this.shopName = rs.getString("shopName");
		this.attribute_id = rs.getInt("attribute_id");
		this.totalAmount = rs.getDouble("totalAmount");
//		this.sale_accomplish = rs.getDouble("sale_accomplish");
//		this.sale_rate = rs.getDouble("sale_rate");
		this.cost_Amount = rs.getDouble("cost_Amount");
//		this.cost_rate = rs.getDouble("cost_rate");
//		this.cost_accomplish = rs.getDouble("cost_accomplish");
		this.views = rs.getLong("views");
		this.guests = rs.getDouble("guests");
		this.success_rate = rs.getDouble("success_rate");
		this.piecesPrice = rs.getDouble("piecesPrice");
		this.pieces_per_price = rs.getDouble("pieces_per_price");
		
		this.name = this.shopName;
	}


	public void addProperties(SalesReportDataBean bean) {
		CustomSalesReportDataBean data = (CustomSalesReportDataBean)bean;
		this.setTotalAmount(this.getTotalAmount() + data.getTotalAmount());
		this.setCost_Amount(this.getCost_Amount() + data.getCost_Amount());
		this.setViews(this.getViews() + data.getViews());
		this.setGuests(this.getGuests() + data.getGuests());
		this.setSuccess_rate(this.getSuccess_rate() + data.getSuccess_rate());
		this.setPiecesPrice(this.getPiecesPrice()
				+ data.getPiecesPrice());
		this.setPieces_per_price(this.getPieces_per_price() + data.getPieces_per_price());
	}


	public String getValueByIndex(int index) {
		return null;
	}

	public double getPiecesPrice() {
		return piecesPrice;
	}

	public void setPiecesPrice(double piecesPrice) {
		this.piecesPrice = piecesPrice;
	}

	public double getPieces_per_price() {
		return pieces_per_price;
	}

	public void setPieces_per_price(double pieces_per_price) {
		this.pieces_per_price = pieces_per_price;
	}

}
